#include <QMap>
#include "track_data_from_file_processing.h"

Track_data_from_file_processing::Track_data_from_file_processing(QObject *parent) : QObject(parent)
{

}

Track_data_from_file_processing::~Track_data_from_file_processing()
{

}

void Track_data_from_file_processing::sl_get_conetent_from(QString content)
{
    QMap<QString, QString>* map(new QMap<QString, QString>);

    QString content_time = content.mid(0, 8);
    map->insert("Time", content_time);
//    emit si_track_data("Time", content_time);

    QStringList track_id_content = content.mid(29).split(",");
    QStringList content_list;

    for (QStringList::Iterator it = track_id_content.begin(); track_id_content.end() != it; ++it) {
        content_list = (*it).trimmed().split("=");
        if ("" == content_list.at(1)) {
            content_list.replace(1, "None");
        }

        map->insert(content_list.at(0), content_list.at(1));
//        emit si_track_data(content_list.at(0), content_list.at(1));
    }

    // 当数据中没有航班号时，手动添加航班号“None”
    if ( !map->contains("callSign")) {
        map->insert("callSign", "None");
    }

//    emit si_track_data_in_map(map);
}
